package com.example.controller;

import com.example.common.Result;
import com.example.entity.Business;
import com.example.service.BusinessService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/business")
public class BusinessController {

    @Resource
    BusinessService businessService;

    @GetMapping("/selectAll")
    public Result selectAll(Business business) {
        List<Business> business_list = businessService.selectAll(business);
        return Result.success(business_list);
    }
    @GetMapping("/selectById/{id}")
    public Result selectById(@PathVariable Integer id) {
        Business business=businessService.selectById(id);
        return Result.success(business);
    }

    @PutMapping("/update")
    public Result update(@RequestBody Business business) {
        businessService.update(business);
        return Result.success();
    }
}
